# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=librespot
pkgver=0.4.2
pkgrel=4
pkgdesc="Open Source Spotify client library"
url="https://github.com/librespot-org/librespot"
arch="all !s390x !riscv64" # limited by cargo
license="MIT"
options="!check" # no test suite
makedepends="cargo alsa-lib-dev cargo-auditable"
install="$pkgname.pre-install"
subpackages="$pkgname-openrc"
source="librespot-$pkgver.tar.gz::https://github.com/librespot-org/librespot/archive/v$pkgver.tar.gz
	$pkgname.initd
	$pkgname.confd

	cargo-bump-libc-lfs64.patch
	"


prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen \
		--features alsa-backend
}

package() {
	install -Dm755 target/release/librespot "$pkgdir"/usr/bin/librespot
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}

sha512sums="
62377c0c7b868a5414c3e62b5edcac118f83c0bf1e218c9aa6e8174c875ab63707fc1eef2e64188bf2aac2891cbbd4fddc086cb4b9b4a760ded20c63fe4f8ebe  librespot-0.4.2.tar.gz
c7cf6dd1afc67d02c710cd01baacee3084812cbf326514667c9b053fe0b4b7769fdac9f7fc4c2e3ee9755c6fe6d3b9bf4fda1279e507e0abd254157adf44d4c2  librespot.initd
7be717bbe23b40d6c52b1e9b1ce4cb6d5f243b75ce5479a28fa3fff97f7e80f565321a839259ae7ee4eba47f490f1c0aec72b52e71d25620a98e4c7bcd696cde  librespot.confd
386e08e1fe5a928f6fbef4a6ad00b39bfcd792121205bff3a644af3010c7451c3746538270806a1c2393aa9d292405d658d50ad2df2d036761624d826a33cc1e  cargo-bump-libc-lfs64.patch
"
